import request from "@/utils/request";

const Users_BASE_URL = "/system/user";

const UsersAPI = {
  getPage(queryParams?: any) {
    return request<any, PageResult<any[]>>({
      url: `${Users_BASE_URL}/search`,
      method: "get",
      params: queryParams,
    });
  },

  getOptions() {
    return request<any, OptionType[]>({
      url: `${Users_BASE_URL}/dict`,
      method: "get",
    });
  },

  add(data: any) {
    return request({
      url: `${Users_BASE_URL}/save`,
      method: "post",
      data: data,
    });
  },

  update(data: any) {
    return request({
      url: `${Users_BASE_URL}/save`,
      method: "put",
      data: data,
    });
  },

  deleteByIds(ids: string) {
    return request({
      url: `${Users_BASE_URL}/${ids}`,
      method: "delete",
    });
  },
  getInfo(queryParams: any) {
    return request<any>({
      url: `/system/user/me`,
      method: "get",
      params: queryParams,
    });
  },
};

export default UsersAPI;
